﻿namespace WinnerCMS.Common.Security.CodeCharts
{
    using System;
    using System.Collections.Generic;
    using System.Linq;

    internal static class CodeChartHelper
    {
        internal static IEnumerable<int> GetRange(int min, int max)
        {
            return GetRange(min, max, null);
        }

        internal static IEnumerable<int> GetRange(int min, int max, Func<int, bool> exclusionFilter)
        {
            Func<int, bool> predicate = null;
            IEnumerable<int> source = Enumerable.Range(min, (max - min) + 1);
            if (exclusionFilter == null)
            {
                return source;
            }
            if (predicate == null)
            {
                predicate = i => !exclusionFilter(i);
            }
            return source.Where<int>(predicate);
        }
    }
}

